class Piper
	attr_accessor :data, :cmds

	WRITE_TO = '/tmp/in'
	READ_FROM = '/tmp/out'

	def initialize
		@data = ["welcome to the show .."]
		@cmds = []
		raise Exception, "#{WRITE_TO} missing"  unless File.exists?(WRITE_TO)
		raise Exception, "#{READ_FROM} missing" unless File.exists?(READ_FROM)
		puts "connect pipes: #{READ_FROM} #{WRITE_TO}, otherwise it write blocks"
		puts "ruby epic-client.rb  < /tmp/in  > /tmp/out"
	end

	def write(cmd)
		@cmds << cmd
		File.open(WRITE_TO,'a') do |f|
			f.puts cmd
		end
		puts "sent command: #{cmd}"

##		File.open(READ_FROM,'r') do |f|
##			@data << f.readline
##		end
##		puts "read result: #{@data.last}"
##		@data.last
		"nada man"
	end
end

